import threading
from library import app
from library.utils.orm import Poc,Target
class TragetAttack(threading.Thread):
    """
    继承线程类,实现并行
    """
    def __init__(self):
        """
        从数据库获取所有 未get_shell 对象,使用get_shell poc攻击
        """
        session = app.session()
        self.target = session.query(Target).filter_by(is_get_shell=False).all()
    def run(self):
        print("TargetAttack start")
        for target in self.target:
            for poc in app.poces:
                poc.poc(target.ip, app.data['getosshell'])